package com.example.demo01.Entity.abstractclass;

/**
 * 抽象类：服务点父类
 * */
public abstract class AbstractServiceCenter {
    //attributes
    protected String name;
    protected String address;
    protected String province;
    protected  String city;
    protected String domain;
    protected Float lon;
    protected Float lat;
    protected String geom;
    //constructors
    public AbstractServiceCenter() {
    }

    public AbstractServiceCenter(String name, Float lon, Float lat) {
        this.name = name;
        this.lon = lon;
        this.lat = lat;
    }

    public AbstractServiceCenter(String name, String address, String province, String city, String domain, Float lon, Float lat, String geom) {
        this.name = name;
        this.address = address;
        this.province = province;
        this.city = city;
        this.domain = domain;
        this.lon = lon;
        this.lat = lat;
        this.geom = geom;
    }
    //toString
    @Override
    public String toString() {
        return "AbstractServiceCenter{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", domain='" + domain + '\'' +
                ", lon=" + lon +
                ", lat=" + lat +
                ", geom='" + geom + '\'' +
                '}';
    }

    //comparators
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AbstractServiceCenter that = (AbstractServiceCenter) o;

        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (address != null ? !address.equals(that.address) : that.address != null) return false;
        if (province != null ? !province.equals(that.province) : that.province != null) return false;
        if (city != null ? !city.equals(that.city) : that.city != null) return false;
        if (domain != null ? !domain.equals(that.domain) : that.domain != null) return false;
        if (lon != null ? !lon.equals(that.lon) : that.lon != null) return false;
        if (lat != null ? !lat.equals(that.lat) : that.lat != null) return false;
        return geom != null ? geom.equals(that.geom) : that.geom == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (province != null ? province.hashCode() : 0);
        result = 31 * result + (city != null ? city.hashCode() : 0);
        result = 31 * result + (domain != null ? domain.hashCode() : 0);
        result = 31 * result + (lon != null ? lon.hashCode() : 0);
        result = 31 * result + (lat != null ? lat.hashCode() : 0);
        result = 31 * result + (geom != null ? geom.hashCode() : 0);
        return result;
    }

    //getter
    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    public String getProvince() {
        return province;
    }

    public String getCity() {
        return city;
    }

    public String getDomain() {
        return domain;
    }

    public Float getLon() {
        return lon;
    }

    public Float getLat() {
        return lat;
    }

    public String getGeom() {
        return geom;
    }

    //setter
    public void setName(String name) {
        this.name = name;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public void setLon(Float lon) {
        this.lon = lon;
    }

    public void setLat(Float lat) {
        this.lat = lat;
    }

    public void setGeom(String geom) {
        this.geom = geom;
    }
}
